package inv.cal.view;

import inv.cal.logic.Manager;

import javax.swing.table.AbstractTableModel;

public class CalendarTableModel extends AbstractTableModel {
	private static final long serialVersionUID = 824200740762321509L;
	Manager calManager	= null;
	
	public CalendarTableModel(Manager calManager) {
		this.calManager	= calManager;
	}

	public int getColumnCount() {
		return calManager.getNumberOfDaysInWeek() + 1;
	}

	public int getRowCount() {
		return calManager.getNumberOfWeeksInMonth();
	}

	public Object getValueAt(int rowIndex, int columnIndex) {
		if(columnIndex == 0)
			return calManager.getWeek(rowIndex);
		else
			return calManager.getDay(columnIndex, rowIndex+1);
	}
	
	@Override
	public String getColumnName(int column) {
		String name	= calManager.getDayName(column);
		return name;
	}
	
	@Override
	public boolean isCellEditable(int rowIndex, int columnIndex) {
		return false;
	}
	
	
}
